<?php
/**
 * Created by IDEA.
 * User: dinesh
 * Date: Apr 11, 2012
 * Time: 1:33:38 PM
 * To change this template use File | Settings | File Templates.
 */
 
class SessionManager {
    public function __construct(){
         session_start();
    }
    public function setData($data){
        $_SESSION['user_id'] = $data['id'];
        $_SESSION['user_name'] = $data['user_name'];
        $_SESSION['profile_id'] = $data['profile_id'];
        $privilege = new Privilege();
        $_SESSION['permission']  = $privilege->getPermissionPrivilege($data['id']);
    }
    public function destroySession(){
       $_SESSION = array();
       session_destroy();
    }
    public function getSession($name){
        return isset($_SESSION[$name])?$_SESSION[$name]:null;
    }
    public function setSession($name,$value){
        $_SESSION[$name]=$value;                
    }

}
